/*
Cuckoo Sandbox - Automated Malware Analysis.
Copyright (C) 2010-2015 Cuckoo Foundation.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdint.h>
#include <winsock2.h>
#include <windows.h>
#include <winioctl.h>
#include <shlobj.h>
#include <wininet.h>
#include "flags.h"
#include "log.h"
#include "ntapi.h"

{% for flag in flags.values(): %}
static const flag_repr_t _{{ flag.name }}_value[] = {
    {%- for row in flag.value %}
    {{ "{" }}{{ row }}, "{{ row }}"{{ "}" }},
    {%- endfor %}
    {0, NULL},
};

static const flag_repr_t _{{ flag.name }}_bitmask[] = {
    {%- for row in flag.enum %}
    {{ "{" }}{{ row }}, "{{ row }}"{{ "}" }},
    {%- endfor %}
    {0, NULL},
};
{% endfor %}

const flag_repr_t *g_flags[FLAGCNT][2] = {
    {NULL, NULL},
{%- for name in flags: %}
    {{ "{" }}_{{ name }}_value, _{{ name }}_bitmask{{ "}" }},
{%- endfor %}
};

const flag_repr_t *flag_value(uint32_t flagidx)
{
    return g_flags[flagidx][0];
}

const flag_repr_t *flag_bitmask(uint32_t flagidx)
{
    return g_flags[flagidx][1];
}
